package com.mezz.bones.im.logic.dev.controller;

import com.mezz.bones.framework.base.domain.response.Result;
import com.mezz.bones.im.common.domain.request.UserSignRequest;
import com.mezz.bones.im.common.service.IAuthService;
import com.mezz.bones.im.logic.domain.response.StringResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api("IM接入者平台 ")
@RequestMapping()
@RestController
public class AuthController {

    @Resource
    private IAuthService authService;

    /**
     * 开发者平台中提供的接口
     * 客户端 - 开发者平台 - IM服务
     * @param request
     * @return
     */

    @PostMapping("/no-auth/user/sign")
    @ApiOperation("用户签名")
    public Result<StringResponse> userSign(@Valid @RequestBody UserSignRequest request) {
        return Result.OK(StringResponse.builder().str(authService.generateToken(request)).build());
    }
}
